"""
Copyright 2009-2010 by Ward, David J ( pymethius@ominian.net )

========================
Comand line start script
========================
Pulling everything together, the WebMud.py script is the main entry point for a command line initiated instance
of the WebMud server|service.

To be refactored later,
"""

from config import bootstrap
import sys
from logging import getLogger
log = getLogger(__name__)

from twisted.internet import epollreactor
epollreactor.install()
from twisted.internet import reactor
from twisted.enterprise import adbapi

#from config import bootstrap
from webmud.lib.wmfactory import WMFactory
from webmud.lib.auth import realm
from webmud.util.reloadablehandlers import ReloadableHandlers
from webmud.lib.dbfactory import DBFactory

#TODO - the key here is showing up in user.handleRequest.routes... Not a problem, but semi-annoying

if __name__ == "__main__":
    dbPool = adbapi.ConnectionPool('sqlite3', './data/webmud.sl3')
    
    DBFactory.register("main", dbPool)
    
    myRealm = realm.Realm(dbPool)    
    
    reactor.listenTCP(4747, WMFactory(myRealm, ))
    reactor.run()
